package org.come.Frame;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.BorderFactory;
import javax.swing.JInternalFrame;
import javax.swing.WindowConstants;
import javax.swing.plaf.basic.BasicInternalFrameUI;

import org.come.Jpanel.GangsGuardJpanel;
import org.come.until.FormsManagement;

public class GangsGuardJframe extends JInternalFrame implements MouseListener {

	private static final long serialVersionUID = 1L;
	private GangsGuardJpanel gangsGuardJpanel;

	public static GangsGuardJframe getGangsGuardJframe() {

		return (GangsGuardJframe) FormsManagement.getInternalForm(53).getFrame();
	}

	public GangsGuardJframe() {
		gangsGuardJpanel = new GangsGuardJpanel();
		this.add(gangsGuardJpanel);
		this.setContentPane(gangsGuardJpanel);
		this.setBorder(BorderFactory.createEmptyBorder());// 去除内部窗体的边框
		((BasicInternalFrameUI) this.getUI()).setNorthPane(null);// 去除顶部的边框
		this.addMouseListener(this);
		this.pack();
		this.setBounds(150, 160, getWidth(), getHeight());
		this.setVisible(false);
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	}

	@Override
	public void mouseClicked(MouseEvent e) {

	}

	@Override
	public void mousePressed(MouseEvent e) {
		// 打开了窗体
		if (e.isMetaDown()) {// 检测鼠标右键单击
			FormsManagement.HideForm(53);
		} else {
			FormsManagement.Switchinglevel(53);
		}

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	public GangsGuardJpanel getGangsGuardJpanel() {
		return gangsGuardJpanel;
	}

	public void setGangsGuardJpanel(GangsGuardJpanel gangsGuardJpanel) {
		this.gangsGuardJpanel = gangsGuardJpanel;
	}

}
